package com.dtstack.mongodb.controller;

import com.dtstack.mongodb.domain.document.ArticleDocument;
import com.dtstack.mongodb.facade.ArticleFacade;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ArticleController
 *
 * <p>
 * </p>
 *
 * @author chuanbai
 * @date 2024/10/18
 */
@RestController
@RequestMapping("/article")
public class ArticleController {

    @Resource
    private ArticleFacade articleFacade;

    @PostMapping("/add")
    public ArticleDocument queryById(@RequestBody ArticleDocument articleDocument){
        return articleFacade.addArticle(articleDocument);
    }

    @GetMapping("/query/id")
    public ArticleDocument queryById(@RequestParam Long id){
        return articleFacade.queryArticle(id);
    }
}
